<template>
  <div class="mui-numbox" data-numbox-min="1" :data-numbox-max="100" style="height:25px;">
    <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
    <input
      id="test"
      class="mui-input-numbox"
      type="number"
      :value="initcount"
      ref="numbox"
      @change="countChanged()"
    />
    <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
  </div>
</template>
<script>
import mui from "../../lib/MUI/js/mui.min.js";
export default {
  mounted() {
    mui(".mui-numbox").numbox();
    console.log(this.max);
  },
  methods: {
    countChanged() {
      //  数量改变了
      // console.log(this.$refs.numbox.value)
      //数据改变覆盖之前的数量值
      this.$store.commit("updataGoodsInfo", {
        id: this.goodsid,
        count: this.$refs.numbox.value
      });
    }
  },
  props: ["initcount", "goodsid"]
};
</script>
<style lang="less" scoped>
</style>